/// code : "0"
/// data : {"list":[{"date":"2022-09-30 星期五","lunch":0,"breakfast":0,"dinner":1}]}
/// msg : "查询成功!"
/// version : 1

class OldFoodOrderResponse {
  OldFoodOrderResponse({
    this.code,
    this.data,
    this.msg,
    this.version,
  });

  OldFoodOrderResponse.fromJson(dynamic json) {
    code = json['code'];
    data = json['data'] != null ? Data.fromJson(json['data']) : null;
    msg = json['msg'];
    version = json['version'];
  }

  String? code;
  Data? data;
  String? msg;
  int? version;

  OldFoodOrderResponse copyWith({
    String? code,
    Data? data,
    String? msg,
    int? version,
  }) =>
      OldFoodOrderResponse(
        code: code ?? this.code,
        data: data ?? this.data,
        msg: msg ?? this.msg,
        version: version ?? this.version,
      );

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['code'] = code;
    if (data != null) {
      map['data'] = data?.toJson();
    }
    map['msg'] = msg;
    map['version'] = version;
    return map;
  }
}

/// list : [{"date":"2022-09-30 星期五","lunch":0,"breakfast":0,"dinner":1}]

class Data {
  Data({
    this.list,
    this.packageConfName
  });

  Data.fromJson(dynamic json) {
    if (json['list'] != null) {
      list = [];
      json['list'].forEach((v) {
        list?.add(OldFoodOrderListData.fromJson(v));
      });
    }
    packageConfName = json['packageConfName'];
  }

  List<OldFoodOrderListData>? list;
  String? packageConfName;

  Data copyWith({
    List<OldFoodOrderListData>? list,
    String? packageConfName,
  }) =>
      Data(
        list: list ?? this.list,
        packageConfName: packageConfName??this.packageConfName
      );

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    if (list != null) {
      map['list'] = list?.map((v) => v.toJson()).toList();
    }
    map['packageConfName'] = packageConfName;
    return map;
  }
}

/// date : "2022-09-30 星期五"
/// lunch : 0
/// breakfast : 0
/// dinner : 1

class OldFoodOrderListData {
  OldFoodOrderListData({
    this.date,
    this.lunch,
    this.breakfast,
    this.dinner,
  });

  OldFoodOrderListData.fromJson(dynamic json) {
    date = json['date'];
    lunch = json['lunch'];
    breakfast = json['breakfast'];
    dinner = json['dinner'];
  }

  String? date;
  int? lunch;
  int? breakfast;
  int? dinner;

  bool get canCancel => breakfast!=null||lunch!=null||dinner!=null;

  OldFoodOrderListData copyWith({
    String? date,
    int? lunch,
    int? breakfast,
    int? dinner,
  }) =>
      OldFoodOrderListData(
        date: date ?? this.date,
        lunch: lunch ?? this.lunch,
        breakfast: breakfast ?? this.breakfast,
        dinner: dinner ?? this.dinner,
      );

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['date'] = date;
    map['lunch'] = lunch;
    map['breakfast'] = breakfast;
    map['dinner'] = dinner;
    return map;
  }
}
